package com.sky.mapper;

import com.sky.entity.OrderDetail;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * ClassName: OrderDetailMapper
 * Description:
 *
 * @Author: 李志鹏
 * @Create: 2023/10/8 9:32
 * @Version: 1.0
 */
@Mapper
public interface OrderDetailMapper {

    /**
     * 批量插入订单明细
     * @param orderDetailList
     */
    void insertBatch(List<OrderDetail> orderDetailList);

    /**
     * 根据订单id获取菜品名称列表
     * @param id
     * @return
     */
    @Select("select name from order_detail where order_id = #{id}")
    List<String> getNamesByOrderId(Long id);

    /**
     * 根据id获取详情列表
     * @return
     */
    @Select("select * from order_detail where order_id = #{id}")
    List<OrderDetail> getByOrderId(Long id);
}
